package com.example.springboot.mapper;

import com.example.springboot.controller.request.BaseRequest;
import com.example.springboot.entity.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BookMapper {
    List<Book> list();

    List<Book> listByCondition(BaseRequest baseRequest);

    void save (Book obj);

    Book getById (Integer id);

    void updateById(Book obj);

    void deleteById (Integer id);


    Book getByBookNo (String bookNo);

    void updateNum (Integer id);

    @Update("update book set nums = nums + 1 where book_no = #{bookNo}")
    void updateRevertNum (String bookNo);
}
